<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <title>CSS 顶部导航样式实例</title>
    <style>
        body {
            margin: 0;
        }

        .topnav {
            overflow: hidden;
            background-color: #333;
        }

        .topnav a {
            float: left;
            display: block;
            color: #f2f2f2;
            text-align: center;
            padding: 14px 16px;
            text-decoration: none;
            font-size: 17px;
        }

        .topnav a:hover {
            background-color: #ddd;
            color: black;
        }

        .topnav a.active {
            background-color: #4CAF50;
            color: white;
        }
    </style>
</head>

<body>
    <div class="topnav">
        <a class="active" href="#home">主页</a>
        <a href="#news">新闻</a>
        <a href="#contact">联系方式</a>
        <a href="#about">关于我们</a>
    </div>

    <div style="padding-left:16px">
        <h2>顶部导航实例</h2>
        <p>信息内容..</p>
    </div>
</body>

</html>